package com.woniuxy.course.controller;

import com.woniuxy.commons.entity.ResponseEntity;
import com.woniuxy.commons.entity.Vedio;
import com.woniuxy.commons.entity.VideoRemark;
import com.woniuxy.commons.service.RemoteUploadingService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author CodingMaster
 * @create 2020-08-05 9:25
 * @description
 */
public class VideoController {
    @Resource
    RemoteUploadingService remoteUploadingService;

    @GetMapping("/findByContent/{content}")
    public ResponseEntity<List<Vedio>> findByContentLike(@PathVariable("content") String content, @RequestParam("page") int page, @RequestParam("limit") int limit) {
        return remoteUploadingService.findByContentLike(content,page,limit);
    }

    @GetMapping("/getVideoByVid/{vid}")
    public ResponseEntity<Vedio> getVideoByVid(HttpServletRequest request, @PathVariable("vid") int vid) {
        return  remoteUploadingService.getVideoByVid(request,vid);
    }

    @GetMapping("/getVideoRemarkByVid/{vid}")
    public ResponseEntity<List<VideoRemark>> getVideoRemarkByVid(@PathVariable("vid") int vid, @RequestParam("page") int page, @RequestParam("limit") int limit) {
        return remoteUploadingService.getVideoRemarkByVid(vid,page,limit);
    }
}
